package com.zhyl.demo.controller;

import com.zhyl.demo.entity.HospitalAddress;
import com.zhyl.demo.service.HospitalAddressService;
import com.zhyl.demo.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * @author yang3
 */
@RestController
@RequestMapping("/hospitalAddress")
public class HospitalAddressController {
    private final HospitalAddressService hospitalAddressService;
    @Autowired
    private HospitalAddressController(HospitalAddressService hospitalAddressService)
    {
        this.hospitalAddressService = hospitalAddressService;
    }

    @RequestMapping("/getHospitalData")
    public Result getHospitalData(){
        ArrayList<HospitalAddress> hospitalData = hospitalAddressService.getHospitalData();
        if (hospitalData!=null){
            return Result.success(hospitalData);
        }else {
            return Result.error("-1","暂无数据");
        }

    }
}
